package com.joshondesign.sdljava.gfx;

import com.joshondesign.sdljava.SDL_Surface;

/**
 * Created by IntelliJ IDEA.
 * User: josh
 * Date: 9/6/11
 * Time: 10:22 AM
 * To change this template use File | Settings | File Templates.
 */
public class SColor implements SPaint{

    public int _sdlcolor;

    public static final SColor RED = new SColor(255,0,0);
    public static final SColor GREEN = new SColor(0,255,0);
    public static final SColor BLUE = new SColor(0,0,255);
    public static final SColor BLACK = new SColor(0, 0, 0);
    public static final SColor WHITE = new SColor(255, 255, 255);
    int r;
    int g;
    int b;

    public SColor(int r, int g, int b) {
        this.r = r;
        this.g = g;
        this.b = b;
        this._sdlcolor = (b<<24) | (g << 16) | (r<<8) | 0xFF;
    }

    public SDL_Surface getImage(SDL_Surface surface) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public static SColor interpolate(SColor A, SColor B, double fraction) {
        int r = (int)(A.r*(1.0-fraction) + B.r*fraction);
        int g = (int)(A.g*(1.0-fraction) + B.g*fraction);
        int b = (int)(A.b*(1.0-fraction) + B.b*fraction);
        return new SColor(r,g,b);
    }
}
